package com.zhoukx.iterator;

import java.util.Iterator;

/**
 * @ClassName ComputerCollage
 * @Description:
 * @Author zhoukx
 * @Date 2020/8/17
 **/
public class ComputerCollage implements Collage {

    Department[] departments;
    int numDepartment = 0;


    public ComputerCollage(){
        departments = new Department[5];
        addDepartment("java专业","java专业");
        addDepartment("PHP专业","PHP专业");
        addDepartment("大数据专业","大数据专业");
    }

    @Override
    public String getName() {
        return "计算机学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departments[numDepartment] = department;
        numDepartment += 1;

    }

    @Override
    public Iterator createIterator() {
        return new ComputerCollegeIterator(departments);
    }
}
